<#include "/admin/utils/ui.ftl"/>
<@layout>

<section class="content-header">
    <h1>人口管理</h1>
    <ol class="breadcrumb">
        <li><a href="${base}/admin">首页</a></li>
        <li class="active">人口管理</li>
    </ol>
</section>
<section class="content container-fluid">
<div class="row">

    <div class="col-md-4 col-md-offset-4 floating-box">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">人口管理</h3>
            </div>
            <div class="panel-body">
                <#include "/classic/inc/action_message.ftl"/>
                <div id="message">
                </div>
                <form id="submitForm" method="POST" action="/admin/theme/save">
                    <div class="form-group " >
                        <input class="form-control" id="id" value="${view.id}" name="id" type="hidden">
                        <label class="control-label" value="${view.name}">姓名</label>
                        <input class="form-control" id="name" value="${view.name}" name="name" type="text" placeholder="字母和数字的组合, 不少于5位" required>
                    </div>

                <div class="form-group ">
                    <label class="control-label" for="content">简介</label>
                    <input class="form-control" id="content" value="${view.content}" name="content" type="text" maxlength="18" placeholder="请输入简介" required>
                </div>
                <div class="form-group ">
                    <label class="control-label" for="adress">地址</label>
                    <input class="form-control" id="adress" value="${view.adress}" name="adress" type="text" placeholder="请输入地址">
                </div>
                    <div class="upload-btn">
                        <label style="width: 80px; margin: 0;">
                            <span >真人图片</span>
                            <input id="url1" name="url" type="text" value="${view.url}" >
                            <input id="upload_btn2" type="file" name="file" accept="application/x-zip-compressed" title="点击添加">
                            <img src="" id="target"  width="100%" height="132px"/>
                        </label>
                    </div>
                <button type="submit" class="btn btn-primary btn-block">
                    提交
                </button>
                </form>
            </div>
        </div>
    </div>

</div>
</section>
<script type="text/javascript">
    $(function () {
        $('a[data-action="toggle"]').click(function () {
            var that = $(this);
            var value = that.data('value');
            $.getJSON('${base}/admin/theme/active', {'theme': value}, function (json) {
                layer.alert(json.message, function(){
                    location.reload();
                });
            })
        });

        $('#upload_btn2').change(function(){
            $(this).upload('${base}/post/upload', function(json){
                $('#target').attr("src",json.path);
                $('#url1').val(json.path);
            });
        });

    })
</script>
</@layout>